package org.example.lostandfound.service;

import org.example.lostandfound.dao.UserDao;
import org.example.lostandfound.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAllUsers() {
        return userDao.findAllUsers();
    }

    @Override
    public User findUserById(Long id) {
        return (User) userDao.findUsersById(id);
    }

    @Override
    public void registerUser(User user) {
        userDao.registerUser(user);

    }

    @Override
    public User updateUser(User user) {
        userDao.updateUser(user);

        return user;
    }

    @Override
    public void deleteUser(Long id) {
        userDao.deleteUser(id);

    }

    @Override
    public User loginUser(String phoneNumber, String password) {

        return userDao.login(phoneNumber, password);
    }
}
